﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace Home.Domain.Entities
{
    public class News
    {
        /// <summary>
        /// 新闻Id
        /// </summary>
        public int? Id { set; get; }
        /// <summary>
        /// 标题
        /// </summary>
        [Required(ErrorMessage = "标题不能为空")]
        [StringLength(50, ErrorMessage = "长度不能超过50个字符")]
        [DisplayName("标题")]
        public string Title { set; get; }
        /// <summary>
        /// 内容
        /// </summary>
        [Required(ErrorMessage = "内容不能为空")]
        [DisplayName("内容")]
        public string Body { set; get; }
        /// <summary>
        /// 新闻时间
        /// </summary>
        [Required(ErrorMessage = "新闻时间不能为空")]
        [DisplayName("新闻时间")]
        public DateTime? CreateDate { set; get; }
        /// <summary>
        /// 新闻类别Id,外键
        /// </summary>
        public int PNewsId { get; set; }
        /// <summary>
        /// 新闻类别
        /// </summary>
        public virtual PNews PNews { get; set; }
    }
}
